package tools.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;


public class BiggerThanValidator implements ConstraintValidator<BiggerThan, Number> {

    private long value;

    @Override
    public void initialize(BiggerThan annotation) {
        value = annotation.value();
    }

    @Override
    public boolean isValid(Number number, ConstraintValidatorContext constraintValidatorContext) {
        return number != null && number.longValue() > value;
    }
}
